<?php $malls = isset($malls) ? $malls :array();?>
<div class='container-fluid'>
<?php echo View::make('share.backend_nav')->with('nav', Config::get('app.nav.mall.sub'));?>
<div class='board'>
<span class='label label-info'>购物网站列表</span>
<a href='javascript:void(0)' class='label label-success pull-right' id='add-mall'>新增</a>
<table class='table table-bordered'>
  <thead>
    <tr>
      <th class='logo'>#LOGO</th>
      <th class='sitename'>#网站名称</th>
      <th class='type'>#网站类型</th>
      <th class='url'>#链接</th>
      <th class='description'>#网站描述</th>
      <th class='op'>#OP</th>
      <th class='op'>#OP</th>
    </tr>
  </thead>
  <tbody>
  <?php foreach ($malls as $m):?>
    <tr>
      <td><img src='<?php echo $m->logo_url;?>' style='height:90px;'/></td>
      <td><?php echo $m->cname;?></td>
      <td><?php echo $m->type->cname;?></td>
      <td><a href='<?php echo $m->url?>' target='_blank'>链接</a></td>
      <td><?php echo $m->description;?></td>
      <td><a href='javascript:void(0)' class='btn btn-mini btn-primary edit'  data-id='<?php echo $m->id;?>' data-cname='<?php echo $m->cname;?>' data-ename='<?php echo $m->ename;?>' data-description='<?php echo $m->description;?>' data-type-id='<?php echo $m->type_id;?>' data-logo-url='<?php echo $m->logo_url;?>' data-url='<?php echo $m->url;?>'>修改</a></td>
      <td><a href='javascript:void(0)' class='btn btn-mini btn-danger delete' data-id='<?php echo $m->id;?>'>删除</a></td>
    </tr>
  <?php endforeach;?>
  </tbody>
</table>
</div>
</div>
<?php 
$types = Type::order_by('updated_at', 'desc')->get();
echo View::make('mall.list.add_modal')->with('types', $types);
echo View::make('mall.list.edit_modal')->with('types', $types);
?>
